package com.ktwlsoft.archivemanage.domain.dao.repository.study;

import com.alibaba.fastjson.JSONObject;
import com.ktwlsoft.archivemanage.domain.dao.entity.study.StudyClass;
import com.ktwlsoft.archivemanage.payload.study.studyClass.ClassManagePageRequest;
import com.ktwlsoft.archivemanage.payload.study.studyClass.StudyClassPagePayload;
import org.apache.ibatis.annotations.Param;

import java.sql.Date;
import java.util.List;

public interface StudyClassMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table study_class
     *
     * @mbg.generated
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table study_class
     *
     * @mbg.generated
     */
    int insert(StudyClass record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table study_class
     *
     * @mbg.generated
     */
    StudyClass selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table study_class
     *
     * @mbg.generated
     */
    List<StudyClass> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table study_class
     *
     * @mbg.generated
     */
    int updateByPrimaryKey(StudyClass record);

    /**
     * 通过banner呈现查询数据 on 2019/12/24 15:58
     *
     * @param bannerShow bannerShow
     * @return List<StudyClass>
     */
    List<StudyClass> selectByBannerShow(@Param("bannerShow") Integer bannerShow,@Param("type") String type);

    /**
     * 根据num查询数据 on 2019/12/24 16:22
     *
     * @param num num
     * @return List<StudyClass>
     */
    List<StudyClass> selectByLimitNum(Integer num, String type);

    /**
     * 集合 on 2019/12/24 16:57
     *
     * @param jsonObject jsonObject
     * @return PageInfo<StudyClass>
     */
    List<StudyClass> findList(JSONObject jsonObject);

    /**
      * 修改播放次数 on 2019/12/31 17:16
      *
      * @param id id
      * @return int
      */
    int updatePlayTime(Long id);

    /**
      * 增加收藏数 on 2019/12/31 17:21
      *
      * @param id id
      * @return int
      */
    int plusCollectTime(Long id);

    /**
     * 减少收藏数 on 2019/12/31 17:21
     *
     * @param id id
     * @return int
     */
    int reduceCollectTime(Long id);

    /**
     * 根据分类id获取课程列表，课程分类删除判断用
     *
     * @param classifyId
     * @return
     */
    List<StudyClass> selectByClassifyId(Long classifyId);

    /**
     * 根据课程类型获取列表，课程管理用
     *
     * @param request
     * @return
     */
    List<StudyClass> selectByConditons(ClassManagePageRequest request);

    List<StudyClassPagePayload> findPage(String state, Long classifyId, Date publishStart, Date publishEnd, String keywords, String order, StudyClass.ClassType classType);

    int changeState(Long id, String state, Boolean bannerShow, Long publisherId, String publisherName,String type);

    List<StudyClass> selectBySubjectId(Long subjectId, String classType);

    Integer checkBanners(boolean shown, String classType);
}